package io.github.annyylxyms.gyncache.command;

import io.github.annyylxyms.gyncache.core.Command;
import io.github.annyylxyms.gyncache.core.GynCache;
import io.github.annyylxyms.gyncache.core.Reply;

/**
 * Ping command.
 * @author Anny
 * @date 2025/1/3 17:24
 */
public class PingCommand implements Command {
    @Override
    public String name() {
        return "PING";
    }

    @Override
    public Reply<?> exec(GynCache cache, String[] args) {
        String ret = "PONG";
        if (args.length >= 5) {
            ret = args[4];
        }
        return Reply.string(ret);
    }
}
